home *** CD-ROM | disk | FTP | other *** search
- Path: news.uh.edu!usenet
- From: Sensarn <txs53132@bayou.uh.edu>
- Newsgroups: comp.lang.c++
- Subject: Inline Assembler and OOP
- Date: 15 Mar 1996 04:06:47 GMT
- Organization: AEtna Insurance Agency
- Message-ID: <4iaqcn$mfu@masala.cc.uh.edu>
- NNTP-Posting-Host: sip-16661.public-dialups.uh.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1 (Windows; U; 16bit)
-
- Are there any restrictions on class data members when used in the asm {}
- block? I have this:
-
- struct double_buffer {
- private:
- unsigned char *buffer; /* Actual data */
- unsigned int buffer_height; /* Height of buffer in pixels */
- unsigned int buffer_width; /* Width of buffer in pixels */
- unsigned int buffer_size; /* Actual size of buffer */
- public:
- double_buffer(int num_lines=200); /* Constructor */
- ~double_buffer(void); /* Destructor */
- void show(void); /* Display double buffer */
- };
-
- Okay -- everything is fine. Now I have my constructor:
-
- double_buffer::double_buffer(int num_lines) {
- buffer_size=(long int)320*num_lines+1;
- buffer=(unsigned char far *)farmalloc(buffer_size);
- asm {
- les di,buffer /* Expression syntax error here */
- mov cx,buffer_size/2 /* Here too */
- xor ax,ax
- cld
- rep stosw
- }
- }
-
- Is there some reason why I cannot access buffer and buffer_size in the
- asm statement (even though the asm statement is inside a member
- function). I even tried making them both public!
-
- --
- ______________________________
-
- Steven Sensarn
- E-Mail - txs53132@bayou.uh.edu
- ______________________________
-
-
-